package com.wanma.thread.threaddemo2;

public class ThreadDemo2 {
/**
 * 有T1、T2、T3三个线程，如何怎样保证T2在T1执行完后执行，T3在T2执行完后执行
 * @param args
 * @throws InterruptedException
 */
	public static void main(String[] args) throws InterruptedException {
		Demo demo = new Demo();
		Demo demo1 = new Demo();
		Demo demo2 = new Demo();
		demo.start();
		demo.join();
		demo1.start();
		demo1.join();
		demo2.start();
		demo2.join();
	}
}

class Demo extends Thread {
	@Override
	public void run() {
		for (int i = 0; i < 10; i++) {
			System.out.println("---------------"+Thread.currentThread().getName()+"----------");

		}
	}
}
